#!/usr/bin/python3
# -*- coding: utf-8 -*-

import pandas as pd
import numpy as np
import talib


def signal(*args):
    # 平均每笔成交，看此分钟是否有大单出现
    # https://bbs.quantclass.cn/thread/14374

    df = args[0]
    n  = args[1]
    factor_name = args[2]

    df[factor_name] = df['quote_volume'].rolling(n, min_periods=1).sum() / df['trade_num'].rolling(n, min_periods=1).sum()

    return df